package com.curd.jpa.base.service.impl.jpapackaging;

import com.curd.jpa.base.dao.IBaseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

/**
 * JPA 的 Mapper 功能集中封装
 * @param <DOMAIN>
 * @param <ID>
 */
public class PackagingServiceImpl<DOMAIN, ID, M extends IBaseMapper<DOMAIN, ID>> implements PackagingService<DOMAIN, ID> {

    @Autowired
    private M mapperPackaging;


    @Override
    public List<DOMAIN> findAll() {
        return mapperPackaging.findAll();
    }

    @Override
    public Page<DOMAIN> findAll(Pageable var1) {
        return mapperPackaging.findAll(var1);
    }

    @Override
    public List<DOMAIN> findAll(Sort var1) {
        return mapperPackaging.findAll(var1);
    }

    @Override
    public List<DOMAIN> findAllById(Iterable<ID> var1) {
        return mapperPackaging.findAllById(var1);
    }

    @Override
    public <S extends DOMAIN> List<S> saveAll(Iterable<S> var1) {
        return mapperPackaging.saveAll(var1);
    }

    @Override
    public void flush() {
        mapperPackaging.flush();
    }

    @Override
    public <S extends DOMAIN> S saveAndFlush(S var1) {
        return mapperPackaging.saveAndFlush(var1);
    }

    @Override
    public void deleteInBatch(Iterable<DOMAIN> var1) {
        mapperPackaging.deleteInBatch(var1);
    }

    @Override
    public void deleteAllInBatch() {
        mapperPackaging.deleteAllInBatch();
    }

//    @Override
//    public DOMAIN getOne(ID var1) {
//        return mapperPackaging.getOne(var1);
//    }

    @Override
    public <S extends DOMAIN> List<S> findAll(Example<S> var1) {
        return mapperPackaging.findAll(var1);
    }

    @Override
    public <S extends DOMAIN> List<S> findAll(Example<S> var1, Sort var2) {
        return mapperPackaging.findAll(var1, var2);
    }

    @Override
    public Optional<DOMAIN> findOne(Specification<DOMAIN> var1) {
        return mapperPackaging.findOne(var1);
    }

    @Override
    public List<DOMAIN> findAll(Specification<DOMAIN> var1) {
        return mapperPackaging.findAll(var1);
    }

    @Override
    public Page<DOMAIN> findAll(Specification<DOMAIN> var1, Pageable var2) {
        return mapperPackaging.findAll(var1, var2);
    }

    @Override
    public List<DOMAIN> findAll(Specification<DOMAIN> var1, Sort var2) {
        return mapperPackaging.findAll(var1, var2);
    }

    @Override
    public long count(Specification<DOMAIN> var1) {
        return mapperPackaging.count(var1);
    }

    @Override
    public List<DOMAIN> findAllByIdIn(Collection<ID> ids, Sort sort) {
        return mapperPackaging.findAllByIdIn(ids, sort);
    }

    @Override
    public Page<DOMAIN> findAllByIdIn(Collection<ID> ids, Pageable pageable) {
        return mapperPackaging.findAllByIdIn(ids, pageable);
    }

    @Override
    public DOMAIN findAllByIdIn(Collection<ID> id) {
        return mapperPackaging.findAllByIdIn(id);
    }
    @Override

    public long deleteByIdIn(Collection<ID> ids) {
        return mapperPackaging.deleteByIdIn(ids);
    }
}
